﻿@using HopNguyenModel
@model List<Content>
@{
    ViewBag.Title = "Thêm sản phẩm";
    Layout = "~/Views/Shared/_BackendLayout.cshtml";
    List<Status> lstStatus = ViewBag.Status;
}

<div class="page-header position-relative">
    <h1>Thêm mới sản phẩm
    </h1>
</div>
<!--/.page-header-->
<div class="row-fluid">
    <div class="tabbable">
        <ul class="nav nav-tabs" id="myTab">
            <li class="active">
                <a data-toggle="tab" href="#tab1">
                    <i class="green icon-home bigger-110"></i>
                    Thông tin chung
                </a>
            </li>
            @*<li>
                <a data-toggle="tab" href="#tab2">Trạng thái
                </a>
            </li>*@
            <li>
                <a data-toggle="tab" href="#tab3">SEO Option
                </a>
            </li>
        </ul>

        <form id="validate" action="/cpanel/createproduct" method="POST" enctype="multipart/form-data">
            <input type="hidden" name="Status" value="True" />
            <div class="tab-content">
                @if (Request["msg"] != null && Request["msg"] == "success")
                {
                    <div class="alert alert-success">
                        <button type="button" class="close" data-dismiss="alert">×</button>
                        <strong>Thành công!</strong> Thêm mới thành công.
                    </div>
                }
                @if (ViewBag.Error != null)
                {
                    <div class="alert alert-error">
                        <button type="button" class="close" data-dismiss="alert">×</button>
                        <strong>Lỗi!</strong> @ViewBag.Error
                    </div>
                }
                <div class="tab-pane active" id="tab1">
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Danh mục</span>
                            </div>
                            <div class="span9">
                                <div class="noSearch">
                                    @Html.DropDownList("TypeId", null, new { @class = "chzn-select" })
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Tên sản phẩm</span>
                            </div>
                            <div class="span9">
                                <input type="text" name="name">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Ảnh đại diện</span>
                            </div>
                            <div class="span3">
                                <input type="file" name="image" id="id-input-file-2">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Thêm nhiều ảnh</span>
                            </div>
                            <div class="span3">
                                <a href="javascript:;" onclick="PopupCenter('/cpanel/addimages', 800, 520)"><img src="/Backend/img/AddRecord.gif" /></a>
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Giá bán</span>
                            </div>
                            <div class="span9">
                                <input type="number" name="Price" value="0">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Trạng thái</span>
                            </div>
                            <div class="span9">
                                <div class="noSearch">
                                    <select class="chosen" name="Status">
                                        <option value="True">Hiện</option>
                                        <option value="False">Ẩn</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Tags</span>
                            </div>
                            <div class="span9">
                                <input type="text" name="tags" class="tags" id="form-field-tags" >
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Mô tả</span>
                            </div>
                            <div class="span9">
                                <textarea name="summary" rows="4"></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span12">
                                <strong>Chi tiết</strong>
                                <textarea name="detail" class="ckeditor" rows="10"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
               @* <div class="tab-pane" id="tab2">
                    @foreach (var item in lstStatus)
                    {
                        <div class="formField">
                            <div class="row-fluid">
                                <div class="span2">
                                    <span class="fLabel">@item.Name</span>
                                </div>
                                <div class="span9">
                                    <input type="checkbox" name="status@(item.Id)" value="@item.Id">
                                </div>
                            </div>
                        </div>
                    }
                </div>*@
                <div class="tab-pane" id="tab3">
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Meta Title</span>
                            </div>
                            <div class="span9">
                                <input type="text" name="MetaTitle">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Meta Keyword</span>
                            </div>
                            <div class="span9">
                                <input type="text" name="MetaKeyword">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Meta Description</span>
                            </div>
                            <div class="span9">
                                <textarea name="MetaDescription" rows="4"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="formButtons">
                    <div class="row-fluid">
                        <div class="span2"></div>
                        <div class="span9">
                            <button class="btn btn-info" type="submit">
                                <i class="icon-ok bigger-110"></i>
                                Tạo mới
                            </button>
                            <button class="btn" type="reset">
                                <i class="icon-undo bigger-110"></i>
                                Làm lại
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="row-fluid">
    <div class="choose-type">
        <div class="span4">
            <strong>Lọc nhóm cha</strong> @Html.DropDownList("TypeId", null, "[No filter]", new { onchange = "typeidchange(this.value)" })
        </div>
    </div>
</div>
<div class="row-fluid">
    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th>Id</th>
                <th>Tên</th>
                <th>Giá bán</th>
                <th>Trạng thái</th>
                <th>Lượt xem</th>
                <th>Danh mục</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>@item.Id</td>
                    <td style="text-align: left"><a href="/Cpanel/EditProduct/@item.Id">@item.Name</a></td>
                    <td>@string.Format("{0:N0} VNĐ", item.Price)</td>
                    <td>@(item.Status == true ? Html.Raw("<span class=\"label label-success arrowed\">Hiện</span>") : Html.Raw("<span class=\"badge badge-important\">Ẩn</span>"))</td>
                    <td>@item.Hit</td>
                    <td>@item.TypeContent.Name</td>
                    <td>
                        <a href="/Cpanel/EditProduct/@item.Id" title="Sửa">Sửa</a> | 
                            <a href="/Cpanel/DeleteProduct/@item.Id" onclick="javascript:return confirm('Are you sure?');" title="Xóa">Xóa</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

